/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2021-08-19 09:27:30
 * @LastEditors: GGB
 * @LastEditTime: 2021-08-19 12:00:23
 */
import 'package:flutter/material.dart';
import 'package:flutter_data_center/components/custom_btn.dart';
import 'package:flutter_data_center/model/warning/warning_model.dart';
import 'package:flutter_data_center/utills/color_utils.dart';

import 'components/warning_desc.dart';

class WarningDetailScreen extends StatelessWidget {
  const WarningDetailScreen({Key key, this.warning}) : super(key: key);
  static String routeName = "/warning_detail";
  final WarningModel warning;

  @override
  Widget build(BuildContext context) => Scaffold(
        appBar: buildAppBar(),
        body: SafeArea(
          child: SingleChildScrollView(
            child: Padding(
              padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.start,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Expanded(
                          child: Text(
                        warning.title,
                        maxLines: 2,
                        style: TextStyle(
                          fontSize: 24,
                        ),
                      )),
                      Container(
                          width: 12,
                          height: 12,
                          decoration: BoxDecoration(
                            color: gColor("#FF5D02"),
                            shape: BoxShape.circle,
                          )),
                      SizedBox(width: 10),
                      Text(
                        "一级",
                        style: TextStyle(
                          fontSize: 12,
                        ),
                      ),
                    ],
                  ),
                  SizedBox(height: 10),
                  Text(
                    warning.time,
                    style: TextStyle(
                      color: gColor("#BCBCBC"),
                      fontSize: 15,
                    ),
                  ),
                  SizedBox(height: 10),
                  Container(
                    width: 176,
                    height: 214,
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(10),
                    ),
                    child: ClipRRect(
                      borderRadius: BorderRadius.circular(10),
                      child: Image.network(warning.image, fit: BoxFit.cover),
                    ),
                  ),
                  SizedBox(height: 10),
                  WarningDesc(title: "地点", desc: warning.address),
                  SizedBox(height: 10),
                  WarningDesc(title: "描述", desc: warning.description),
                  SizedBox(height: 100),
                  CustomBtn(
                    text: '处理',
                    onTap: () {},
                    height: 45,
                    width: 365,
                    style: TextStyle(fontSize: 14),
                    primary: gColor("#08D187"),
                  ),
                ],
              ),
            ),
          ),
        ),
      );
  AppBar buildAppBar() {
    return AppBar(
      backgroundColor: Colors.transparent,
      centerTitle: true,
      title: Text(
        "校园隐患",
        style: TextStyle(
          fontSize: 18,
        ),
      ),
      elevation: 0,
    );
  }
}
